Revision: tla--integration--1.3--patch-13
Archive: scott@netsplit.com--2004
Creator: Scott James Remnant <scott@netsplit.com>
Date: Fri Oct 22 04:16:05 BST 2004
Standard-date: 2004-10-22 03:16:05 GMT
New-files: tests/.arch-ids/test-version-order.sh.id
    tests/test-version-order.sh
Modified-files: libarch/archive.c libarch/inv-ids.c
    libarch/namespace.c tests/Makefile.in
    tests/test-parse-package-name.sh
New-patches: scott@netsplit.com--2004/tla--integration--1.3--patch-13
Summary: port dpkg-style versions and sorting to tla
Keywords: 

 * libarch/namespace.c (over_version): Rewrite function to increase
   the range of permitted characters.  Version must still start with
   a digit, however that may now also be followed by any alphanumeric,
   period ('.'), plus ('+'), colon (':'), dash ('-') and tilde ('~').

   (version_cmp_n): New function called by arch_names_cmp (); checks
   whether either version argument has a colon (':') treat the part
   of the string up to that point as a numeric and compare against the
   other, defaulting to zero if not present.

   This "epoch" can be used to reset your versioning and start again;
   1:... will sort higher than anything without an epoch, or with a
   zero epoch.

   (ver_cmp_n): New function called by version_cmp_n () if both epochs
   match; compares versions according to the tried and trusted dpkg
   algorithm:
   
   Strings are broken down into repeated sequences of non-digits and
   sequences of digits.

   Each non-digit sequence is compared according to the following
   rules:

     - alphabetical characters sort in alphabetical order

     - punctuation has a higher value than all alphabetical
       characters, but retain ASCII order.

     - tilde has a negative order and sorts lower than anything else
       *including* the end of string.  In other words, "1.0~pre1"
       sorts lower than "1.0"

     - any other character sorts higher than the end of string.

   Each digit sequence is compared numerically.

   This breaks "2.4.0~pre1" into the following sequences:

     <digit: 2> <non-digit: "."> <digit: 4> <non-digit ".">
     <digit: 0> <non-digit: "~pre"> <digit: 1>

   This therefore sorts higher than 2.2.0, because the third digit
   sequence wins, but lower than 2.4.0~rc1 because "~pre" is
   alphabetically lower than "~rc".

   (ver_order_n): New function called by ver_cmp_n () that returns the
   sort order for the character given as an integer than can be
   compared with others.

 * libarch/inv-ids.c (is_at_or_underneath_archdir): Allow tilde ('~')
   in names of files and directories under {arch}, it's not going to
   do anything dangerous and is now used for "pre-versions".

 * libarch/archive.c (make_tmp_tar_archive): Also pass '--force-local'
   to invocation of tar to stop it interpreting a colon (':') as an
   instruction to fetch things with rsh.

 * tests/Makefile.in (test-scripts): Add new test-version-order.sh
   script.

 * tests/test-version-order.sh: New set of test cases to test that
   tla gets the version order right and picks the latest version of
   a branch when given a version-less package.

 * tests/test-parse-package-name.sh: Increase tests to check tla is
   able to parse the newer-style version numbers.

